package com.extension.company.view.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.extension.company.admin.R;

/**
 * 作者:zwk
 * 联系方式：497981239@qq.com
 * 时间：on 2019/6/25 21:41
 * 功能：
 */
public class MessageDeatialAdapter extends RecyclerView.Adapter<MessageDeatialAdapter.MessageHolder> {

	private int type;
	private Context context;

	public MessageDeatialAdapter(Context context, int type) {
		this.type = type;
		this.context = context;
	}

	@NonNull
	@Override
	public MessageHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
		View view = null;
		if (type == 0) {
			view = LayoutInflater.from(context).inflate(R.layout.message_notifiction_itme, viewGroup, false);

		} else if (type == 1) {
			view = LayoutInflater.from(context).inflate(R.layout.message_activity_itme, viewGroup, false);


		} else if (type == 2) {
			view = LayoutInflater.from(context).inflate(R.layout.message_translate_itme, viewGroup, false);

		}

		return new MessageHolder(view);
	}

	@Override
	public void onBindViewHolder(@NonNull MessageHolder messageHolder, int i) {
		if (type==1&&i == 1&&null!=messageHolder.message_notification_item_img) {
			messageHolder.message_notification_item_img.setBackgroundResource(R.drawable.message_notification_item_coupon_img);
		}

	}

	@Override
	public int getItemCount() {
		return 3;
	}

	class MessageHolder extends RecyclerView.ViewHolder {
		private ImageView message_notification_item_img;

		public MessageHolder(@NonNull View itemView) {
			super(itemView);
			if (type == 0) {
				message_notification_item_img = itemView.findViewById(R.id.message_notification_item_img);
			}
		}
	}
}
